

heckman incvote  log_in_spend_2  log_ch_spend_2  partisan quasipartisan distelect  ///
qualchal electfirst compet55 polarization murder ///
 allspeech2 politregs2 partyregs2  SOLICIT anydq yespolit i.broad ///
 priordiscactions prioradvopins jccc_strong ///
 yr1990-yr2008, ///
select(contested=partisan quasipartisan polarization distelect murder compet55 electfirst term lawyers allspeech2 politregs2 partyregs2 jccc_strong SOLICIT anydq yespolit i.broad ) vce(cl state)
outreg using "p:\Documents\inc-ch heckman 6-15.doc", se starlevels(10 5 1) varlabels ///
 summstat(N\N_cens\N_clust\chi2\p\ll\chi2_c\p_c) summtitles (N\Censored Obs.\# Clusters\Wald chi2\Prob > chi2\Log pseudolikelihood\Wald test of Ind. equations chi2\prob > chi2) ///
   ctitles("", "Variable", "Estimate")  replace
estimates store heckman2


heckman incvote  log_in_spend_2  log_ch_spend_2  partisan quasipartisan distelect  ///
qualchal electfirst compet55 polarization murder ///
 allspeech2 politregs2 partyregs2  SOLICIT anydq yespolit ///
 i.broad  broadspeech broad_polit broad_party ///
 priordiscactions prioradvopins jccc_strong ///
 yr1990-yr2008, ///
select(contested=partisan quasipartisan polarization distelect murder compet55 electfirst term lawyers allspeech2 politregs2 partyregs2 jccc_strong SOLICIT anydq yespolit i.broad ) vce(cl state)
outreg using "p:\Documents\inc-ch heckman 6-15.doc", se starlevels(10 5 1) varlabels ///
 summstat(N\N_cens\N_clust\chi2\p\ll\chi2_c\p_c) summtitles (N\Censored Obs.\# Clusters\Wald chi2\Prob > chi2\Log pseudolikelihood\Wald test of Ind. equations chi2\prob > chi2) ///
   ctitles("", "Variable", "Model 2")  merge
estimates store heckman3



heckman incvote  log_in_spend_2  log_ch_spend_2  partisan quasipartisan distelect  ///
qualchal electfirst compet55 polarization murder ///
 allspeech2 politregs2 partyregs2  SOLICIT anydq yespolit ///
 i.broad  broadspeech broad_polit broad_party ///
 priordiscactions prioradvopins jccc_strong ///
 yr1990-yr2008, ///
select(contested=partisan quasipartisan polarization distelect murder compet55 electfirst term lawyers allspeech2 politregs2 partyregs2 jccc_strong SOLICIT anydq yespolit ///
 i.broad broadspeech broad_polit broad_party ) vce(cl state)
outreg using "p:\Documents\inc-ch heckman 6-15.doc", se starlevels(10 5 1) varlabels ///
  summstat(N\N_cens\N_clust\chi2\p\ll\chi2_c\p_c) summtitles (N\Censored Obs.\# Clusters\Wald chi2\Prob > chi2\Log pseudolikelihood\Wald test of Ind. equations chi2\prob > chi2) ///
  ctitles("", "Variable", "Model 3")  merge
estimates store heckman4


heckman incvote log_in_spend_2 log_ch_spend_2  partisan quasipartisan distelect  ///
qualchal electfirst compet55 polarization murder ///
 allspeech2 politregs2 partyregs2  SOLICIT anydq yespolit ///
 i.broad  i.broad#c.allspeech2 i.broad#c.politregs2 i.broad#c.partyregs2 ///
 priordiscactions prioradvopins jccc_strong ///
 yr1990-yr2008, ///
select(contested=partisan quasipartisan polarization distelect murder compet55 electfirst term lawyers allspeech2 politregs2 partyregs2 jccc_strong SOLICIT anydq yespolit ///
 i.broad  i.broad#c.allspeech2 i.broad#c.politregs2 i.broad#c.partyregs2 ) vce(cl state)
outreg using "p:\Documents\inc-ch heckman 6-15.doc", se starlevels(10 5 1) varlabels ///
  summstat(N\N_cens\N_clust\chi2\p\ll\chi2_c\p_c) summtitles (N\Censored Obs.\# Clusters\Wald chi2\Prob > chi2\Log pseudolikelihood\Wald test of Ind. equations chi2\prob > chi2) ///
  ctitles("", "Variable", "Estimates")  replace
estimates store heckmaninteract



*Figure 6.1
estimates restore heckman2
margins, at(politregs2=(0 1 2 3 4)) predict(psel) atmeans
marginsplot, allsim
graph save "p:\Documents\fig 6.1 politregsheckmancontest.gph", replace
  
estimates restore heckman2
margins, at(yespolit=(0 1 2)) predict(psel) atmeans
marginsplot, allsim
graph save "p:\Documents\fig 6.1 yespolitsheckmancontest.gph", replace 

graph combine "p:\Documents\fig 6.1 politregsheckmancontest.gph"  ///
"p:\Documents\fig 6.1 yespolitsheckmancontest.gph", ///
col(2) iscale(1) ysize(4) xsize(8) saving("p:\Documents\fig 6.1.gph")
graph export "p:\Documents\fig 6.1.tif", as(tif) width(1800) replace

*Fig 6.2
estimates restore heckmaninteract

margins i.broad, at(allspeech=(0(1)3)) predict(psel) atmeans 
marginsplot , allsim
graph save "p:\Documents\fig 6.2 broadspeechheckmancontested.gph", replace 


margins i.broad, at(politregs2=(0(1)4)) predict(psel) atmeans
marginsplot, allsim
graph save "p:\Documents\fig 6.2 broadpolitheckmancontested.gph", replace 

margins i.broad, at(partyregs2=(0 1 2 3 4 5)) predict(psel) atmeans
marginsplot, allsim
graph save "p:\Documents\fig 6.2 broadpartyheckmancontested.gph", replace 

graph combine "fig 6.2 broadspeechheckmancontested.gph"  ///
"p:\Documents\fig 6.2 broadpolitheckmancontested.gph" ///
"p:\Documents\fig 6.2 broadpartyheckmancontested.gph", ///
col(2) iscale(1) ysize(8) xsize(8) saving("p:\Documents\fig 6.2.gph", replace)
graph export "p:\Documents\fig 6.2 7-7.tif", as(tif) width(1800) replace

*Figure 6.3
estimates restore heckman2 
margins, at(yespolit=(0 1 2)) atmeans
marginsplot, allsim
graph save "p:\Documents\fig 6.3 yespolitsheckmanincumbshare.gph", replace 

estimates restore heckman2
margins, at(anydq=(0 1)) atmeans
marginsplot, allsim
graph save "p:\Documents\fig 6.3 dqheckmanincumbshare.gph", replace 

graph combine "p:\Documents\fig 6.3 yespolitsheckmanincumbshare.gph"  ///
"p:\Documents\fig 6.2 dqheckmanincumbshare.gph", ///
col(2) iscale(1) ysize(4) xsize(8) saving("p:\Documents\fig 6.2.gph", replace)
graph export "p:\Documents\fig 6.3.tif", as(tif) width(1800) replace





*Figure 6.4
margins, predict(psel) at(politregs2=(0 4) partisan=(0 1) quasipartisan=(0) (median)  log_in_spend_2  log_ch_spend_2 polarization murder (asobserved) _all) 
marginsplot , xdimension( partisan politregs2) horizontal recast(scatter)
graph save "p:\Documents\fig 6.party politregsselect.gph", replace

margins, predict(psel) at(yespolit=(0 2) partisan=(0 1) quasipartisan=(0) (median)  log_in_spend_2  log_ch_spend_2 polarization murder (asobserved) _all) 
marginsplot , xdimension( partisan yespolit) horizontal recast(scatter)
graph save  "p:\Documents\fig 6.party yespolitselect.gph", replace



margins, at(yespolit=(0 2)  log_ch_spend_2=(4.73637 8.083692 9.430858) quasipartisan=(0) (median)  log_in_spend_2  polarization murder (asobserved) _all) 
marginsplot , xdimension(  log_ch_spend_2 yespolit) horizontal recast(scatter)
graph save  "p:\Documents\fig6.spending.gph", replace


graph combine "p:\Documents\fig 6.party politregsselect.gph" ///
"p:\Documents\fig 6.party yespolitselect.gph" ///
"p:\Documents\fig6.spending.gph", ///
col(2) altshrink ysize(8) xsize(8) saving("p:\Documents\fig 6.3.gph", replace)
graph export "p:\Documents\fig 6.3.tif", as(tif) width(1800) replace







graph combine "p:\Documents\research\Book\Data & analysis\chapter 6\revision\fig 6.party politregsselect.gph" ///
"p:\Documents\research\Book\Data & analysis\chapter 6\revision\fig 6.party yespolitselect.gph" ///
"p:\Documents\research\Book\Data & analysis\chapter 6\revision\fig6.spending.gph", ///
col(2) altshrink ysize(8) xsize(8) saving("p:\Documents\research\Book\Data & analysis\chapter 6\revision\fig 6.3.gph", replace)
graph export "P:\Documents\research\Book\Revised draft\fig 6.3.tif", as(tif) width(1800) replace

